package ruifeng.zcj.communcationring.ui.circle;

import android.webkit.WebView;

import ruifeng.zcj.communcationring.base.WebViewFragment;
import ruifeng.zcj.communcationring.groble.FragmentArgs;
import ruifeng.zcj.communcationring.groble.Whole;
import ruifeng.zcj.communcationring.ui.LoginRegisterActivity;

/**
 * 圈子
 * Created by Administrator on 2016/8/16 0016.
 */
public class CircleFragment extends WebViewFragment {

    public static final String FILM_URL = "CircleFragment";

    @Override
    protected String LoadUrl() {
        return Whole.web_public2;
    }

    // 切换到其他Fragment
    @Override
    protected void onUserInvisible() {
        mWebview.stopLoading();
    }

    // 判断跳转到哪个activity里面
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        if (!url.equals(Whole.web_public2)) {// 如果不等于首页
            FragmentArgs fragmentArgs = new FragmentArgs();
            fragmentArgs.add(FILM_URL, url);


            if (url.equals(Whole.Register)) {// 登录选择用户
                LoginRegisterActivity.launch(getBaseActivity(), CircleFragment.class, fragmentArgs);
            } else {
                CircleAcvitity.launch(getBaseActivity(), CircleFragment.class, fragmentArgs);
            }

        }
        return false;
    }


}
